Imports DotNetNuke
Imports DotNetNuke.Common
Namespace Active.Modules.Forums
    Public Class af_profilesubscriptions
        Inherits ForumBase
        Protected WithEvents Label26 As System.Web.UI.WebControls.Label
        Protected WithEvents Label27 As System.Web.UI.WebControls.Label
        Protected WithEvents dgrdSubs As System.Web.UI.WebControls.DataGrid
        Protected WithEvents Label28 As System.Web.UI.WebControls.Label
        Protected WithEvents dgrdForumSubs As System.Web.UI.WebControls.DataGrid
        Private Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Init
            Me.LocalResourceFile = "~/DesktopModules/ActiveForums/App_LocalResources/SharedResources.resx"
        End Sub

        Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Try
                If Me.UserId = Convert.ToInt32(Request.Params("uid")) Or CType(Session("isMod"), Boolean) = True Then
                    If Not Request.Params("uid") Is Nothing Then
                        BindSubs(Int32.Parse(Request.Params("uid")), PortalId)
                        BindForumSubs(Int32.Parse(Request.Params("uid")), PortalId)
                    End If
                End If

            Catch ex As Exception

            End Try
        End Sub
        Private Sub BindSubs(ByVal UserID As Integer, ByVal PortalID As Integer)
            'Dim objsubs As New PostController
            'dgrdSubs.DataSource = objsubs.NTForums_GetUserSubscriptions(UserID, PortalID)
            'dgrdSubs.DataBind()
        End Sub
        Private Sub BindForumSubs(ByVal UserID As Integer, ByVal PortalID As Integer)
            'Dim objsubs As New PostController
            'dgrdForumSubs.DataSource = objsubs.NTForums_GetUserForumSubscriptions(UserID, PortalID)
            'dgrdForumSubs.DataBind()
        End Sub

        Private Sub dgrdSubs_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgrdSubs.DeleteCommand
            Dim intSubID As Integer
            intSubID = CType(dgrdSubs.DataKeys(e.Item.ItemIndex), Integer)
            Dim objsubs As New SubscriptionController
            'TODO: Fix this
            'objsubs.NTForums_DeleteSubscription(intSubID)
            Response.Redirect(Request.RawUrl)
        End Sub

        Private Sub dgrdForumSubs_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgrdForumSubs.DeleteCommand
            Dim intSubID As Integer
            intSubID = CType(dgrdForumSubs.DataKeys(e.Item.ItemIndex), Integer)
            Dim objsubs As New SubscriptionController
            'TODO: Fix this
            'objsubs.NTForums_DeleteForumSubscription(intSubID)
            Response.Redirect(Request.RawUrl)
        End Sub
        Public Function GetResourceString(ByVal Key As String) As String
            Return Utilities.GetSharedResource(Key)
        End Function
    End Class
End Namespace